<template>
	<view class="clue-page">
		<u-navbar title-size="36" height="42" :border-bottom="false" title="线索列表"></u-navbar>
		<div class="clue-filter">
			<view class="clue-bar">
				<view class="search-box">
					<image src="../../static/images/search-2.png" mode="" class="search-icon"></image>
					<view class="flex_bd">
						<input type="text" placeholder-style="color:#9C9C9C" value="" placeholder="请输入产品名称/型号" />
					</view>
				</view>
			</view>
			<u-dropdown active-color="#A2C833" menu-icon="arrow-down-fill" menu-icon-size="0">
				<u-dropdown-item v-model="value1"  :title="title1" :options="options1" @change="change1"></u-dropdown-item>
				<u-dropdown-item v-model="value2" :title="title2" :options="options2" @change="change2"></u-dropdown-item>
			</u-dropdown>
		</div>
		<view class="list-main">
			<view class="clue-cell flex-center" v-for="(res,index) in list" :key="res.id" @click="openUrl('/pages/clue/clueDetail')">
				<view class="flex_bd">
					<view class="list-title">{{res.title}}</view>
					<view class="list-item"><text>线索 {{res.clue}}</text> <text class="tag" :class="{errer:res.isErrer}" v-for="(item,index) in res.tag" :key="res.index">{{item}}</text></view>
					<view class="list-meta flex-center">
						<view class="meta-item">
							<text class="tag">{{res.model}}</text>
							<text class="t">x</text>
							<text class="t">{{res.number}}</text>
						</view>
						<view class="meta-item">
							<text class="tag">{{res.model}}</text>
							<text class="t">x</text>
							<text class="t">{{res.number}}</text>
						</view>
					</view>
				</view>
				<image class="icon" src="../../static/images/right-lg.png" mode=""></image>
			</view>
		</view>
		<u-tabbar inactive-color="#C8C8CC" active-color="#9DC851" v-model="footcurrent" :list="tabbarlist"
			:mid-button="true" @change="barchange"></u-tabbar>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				value1: 1,
				value2: 1,
				title1: '线索状态',
				title2: '设备机型',
				options1: [{
						label: '默认排序',
						value: 1,
					},
					{
						label: '距离优先',
						value: 2,
					}
				],
				options2: [{
						label: '混凝土机械 湿喷机 ZC3017',
						value: 1,
					},
					{
						label: '桩工机械 混凝土搅拌站 410C-85(V)',
						value: 2,
					},
					{
						label: '路面机械 车载泵 420C-85(V)',
						value: 3,
					},
				],
				// tab
				tabbarlist: '',
				footcurrent: 2,
				list:[{
					id:1,
					title:'太平洋销售集团',
					clue:'UB20091910',
					tag:['跟进中','有成单'],
					model:'ZE205E-10',
					number:5,
					isErrer:false
				},{
					id:2,
					title:'太平洋销售集团',
					clue:'UB20091910',
					tag:['已关闭','作废'],
					model:'ZE205E-10',
					number:5,
					isErrer:true
				}]
			}
		},
		onLoad() {
			this.tabbarlist = [{
					iconPath: "/static/images/foot1.png",
					selectedIconPath: "/static/images/foot1_on.png",
					text: '首页',
					isDot: false,
					customIcon: false,
					pagePath: "/pages/index/index"
				},
				{
					iconPath: "/static/images/foot2.png",
					selectedIconPath: "/static/images/foot2_on.png",
					text: '产品',
					customIcon: false,
					pagePath: "/pages/product/product"
				},
				{
					iconPath: "/static/images/middle.png",
					selectedIconPath: "/static/images/middle.png",
					midButton: true,
					customIcon: false,
					pagePath: "/pages/clue/newClue"
				},
				{
					iconPath: "/static/images/foot3.png",
					selectedIconPath: "/static/images/foot3_on.png",
					text: '线索',
					customIcon: false,
					pagePath: "/pages/clue/clue"
				},
				{
					iconPath: "/static/images/foot4.png",
					selectedIconPath: "/static/images/foot4_on.png",
					text: '我的',
					isDot: false,
					customIcon: false,
					pagePath: "/pages/ucenter/ucenter"
				},
			]
		},
		methods: {
			open(index) {
				// 展开某个下来菜单时，先关闭原来的其他菜单的高亮
				// 同时内部会自动给当前展开项进行高亮
				this.$refs.uDropdown.highlight();
			},
			close(index) {
				// 关闭的时候，给当前项加上高亮
				// 当然，您也可以通过监听dropdown-item的@change事件进行处理
				this.$refs.uDropdown.highlight(index);
			},
			change2(value) {
				// 更多的细节，如有需要请自行根据业务逻辑进行处理
				this.title2 = this.options2[value-1].label
				
			},
			change1(value) {
				// 更多的细节，如有需要请自行根据业务逻辑进行处理
				this.title1 = this.options1[value-1].label
				
			},
			openUrl(e) {
				console.log(e)
				uni.navigateTo({
					url: e
				});
			},
			barchange(e) {
				if (e == 2) {
					uni.navigateTo({
						url: '/pages/clue/newClue'
					});
				}
			}
		}
	}
</script>

<style lang="scss">
	.clue-cell {
		padding: 30rpx 10rpx 30rpx 30rpx;
		background: rgba(255, 255, 255, .6);
		border-radius: 12rpx;
		margin-bottom: 30rpx;

		.list-title {
			font-weight: bold;
			font-size: 32rpx;
			margin-bottom: 18rpx;
		}

		.list-item {
			display: flex;
			align-items: center;
			color: #303337;
			margin-bottom: 18rpx;

			.tag {
				border-radius: 3px;
				line-height: 44rpx;
				font-size: 24rpx;
				padding: 0 10rpx;
				margin-left: 10rpx;
				background-color: #A2C833;
				color:#fff;
			}
			
			.errer{
				background-color: #A5A098;
			}
		}

		.icon {
			width: 64rpx;
			height: 64rpx;
		}

		.meta-item {
			display: flex;
			align-items: center;
			margin-right: 50rpx;
			color: #A2C833;
			font-size: 28rpx;

			.t {
				margin-left: 20rpx;
			}

			.tag {
				border-radius: 3px;
				line-height: 44rpx;
				font-size: 24rpx;
				padding: 0 10rpx;
				background-color: rgba(162, 200, 51, .1);
			}
			
		}

		.meta-item:last-child {
			margin-right: 0;
		}
	}

	.list-main {
		padding: 30rpx;
	}

	page {
		background: #F5F5F5;
	}

	.clue-filter {
		.clue-bar {
			padding: 10rpx 30rpx;
		}

		background-color: #FFFFFF;

		/deep/ .u-dropdown__menu__item__arrow {
			width: 24rpx;
			height: 24rpx;
			background: url(../../static/images/down-arrow.png) no-repeat;
			background-size: contain;
		}
	}
	
	/deep/  .u-dropdown__menu__item__text{
		max-width: 180rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		text-align: right;
	}

	.search-box {
		background: #F3F4F6;
		border-radius: 36px;
		height: 72rpx;
		padding: 0 20rpx;
		display: flex;
		align-items: center;
		border-radius: 40rpx;

		.search-icon {
			margin-right: 10rpx;
			width: 40rpx;
			height: 40rpx;
			display: block;
		}

		.reset-link {
			font-size: 28rpx;
			padding: 0 20rpx;
		}

		input {
			font-size: 28rpx;
		}
	}

	/deep/ .u-tabbar__content__circle__button {
		width: 136rpx !important;
		height: 136rpx !important;
	}

	/deep/ .u-tabbar__content__circle__button image {
		width: 136rpx !important;
		height: 136rpx !important;
	}

	/deep/ .u-tabbar__content__circle__border {
		display: none !important;
	}
</style>
